package com.pay.game.central.web.controller;

import com.alibaba.fastjson.JSONObject;
import com.pay.game.central.common.Result;
import com.pay.game.central.common.ResultGenerator;
import com.pay.game.central.security.annotaion.PassToken;
import com.pay.game.central.web.service.CountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

@Controller
@RequestMapping("/count")
public class CountController {

    @Autowired
    private CountService countService;

    @GetMapping("/user/{userId}")
    @PassToken
    @ResponseBody
    Result<Map> userCount(@PathVariable String userId){
        return ResultGenerator.genSuccessResult(countService.userCount(userId));
    }
}
